<!DOCTYPE html>
<html lang="zh" xmlns:th="https://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	
	<title>登录页面</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" /> 
	
	<script type="text/javascript" th:src="@{/front/js/jquery.min.js}"></script>
	<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>

	<link rel="stylesheet" type="text/css" href="/public/front-login/vendor/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/public/front-login/fonts/font-awesome-4.7.0/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="/public/front-login/fonts/iconic/css/material-design-iconic-font.min.css">
	<link rel="stylesheet" type="text/css" href="/public/front-login/css/util.css">
	<link rel="stylesheet" type="text/css" href="/public/front-login/css/main.css">
</head>

<body>

	<div class="limiter">
		<div class="container-login100" style="background-image: url('/public/front-login/images/bg-01.jpg');">
			<div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54">
				<form class="login100-form validate-form">
					<span class="login100-form-title p-b-49" style="padding-bottom: 29px;">登录</span>
					<span id="operTip" style="text-align:center;display: block;color: #f5222d;"></span>
					 <input type="hidden" id="toPage" name="toPage" th:value="${toPage}">
					<div class="wrap-input100 validate-input m-b-23" data-validate="请输入用户名">
						<span class="label-input100">用户名</span>
						<input class="input100" type="text" id="loginName" name="loginName" placeholder="请输入用户名" autocomplete="off" value="">
						<span class="focus-input100" data-symbol="&#xf206;"></span>
					</div>

					<div class="wrap-input100 validate-input" data-validate="请输入密码">
						<span class="label-input100">密码</span>
						<input class="input100" type="password" id="password" name="password" placeholder="请输入密码" value="">
						<span class="focus-input100" data-symbol="&#xf190;"></span>
					</div>

					<div class="text-right p-t-8 p-b-31">
						<a id="forgetPwdBtn">忘记密码？</a>
					</div>

					<div class="container-login100-form-btn">
						<div class="wrap-login100-form-btn">
							<div class="login100-form-bgbtn"></div>
							<button class="login100-form-btn" type="button">登 录</button>
						</div>
					</div>

					<!-- <div class="txt1 text-center p-t-54 p-b-20">
						<span>第三方登录</span>
					</div>

					<div class="flex-c-m">
						<a href="#" class="login100-social-item bg1">
							<i class="fa fa-wechat"></i>
						</a>

						<a href="#" class="login100-social-item bg2">
							<i class="fa fa-qq"></i>
						</a>

						<a href="#" class="login100-social-item bg3">
							<i class="fa fa-weibo"></i>
						</a>
					</div> -->

					<div class="flex-col-c p-t-25">
						<a th:href="${'/bbs/front/toReg?toPage='+toPage}" class="txt2">立即注册</a>
					</div>
				</form>
			</div>
		</div>
	</div>

	<!-- <script src="/public/front-login/vendor/jquery/jquery-3.2.1.min.js"></script> -->
	<script src="/js/jquery.min.js"></script>
	<script src="/public/front-login/js/main.js"></script>
	
	
	 <script>
	 
	 $(function () {
		 $(".login100-form-btn").click(function(){
			 $.ajax({
		            type: "POST",
		            url: "/bbs/front/login",
		            data: {"loginName": $("#loginName").val(),"password":$("#password").val(),"toPage":$("#toPage").val()},
		            dataType: "json",
		            success: function (data) {
		            	console.info(data);
		                if (data.code == 200) {
		                	window.location.href=data.redirectPage;
		                }else{
		                	$("#operTip").html(data.msg);
		                }
		            },
		            error: function (jqXHR) {
		                //layer.msg('发送错误：' + jqXHR.status, {icon: 2});
		                $("#operTip").html('发送错误：' + jqXHR.status);
		            },
		        });
		 });
		 
		 $("#forgetPwdBtn").click(function(){
			 layer.confirm("确定要找回密码吗?", {
                 icon: 3,
                 title: "系统提示",
                 btn: ['确认', '取消']
             }, function (index) {
                 layer.close(index);
                 $.ajax({
 		            type: "POST",
 		            url: "/bbs/front/toForgetPwd",
 		            data: {"loginName": $("#loginName").val(),"toPage":$("#toPage").val()},
 		            dataType: "json",
 		            success: function (data) {
 		            	console.info(data);
 		            	 if (data.code == 200) {
 		                     layer.msg(data.msg, {icon: 1});
 		                     window.location.href="/bbs/front/toResetPwd?loginName="+$("#loginName").val()+"&toPage="+$("#toPage").val();
 		                 } else {
 		                     layer.msg(data.msg, {icon: 2});
 		                 }
 		            },
 		            error: function (jqXHR) {
 		                //layer.msg('发送错误：' + jqXHR.status, {icon: 2});
 		                $("#operTip").html('发送错误：' + jqXHR.status);
 		            },
 		        });
             });
		 });
	 });
	 </script>
</body>

</html>